home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / FW_CBitmap at various pixel dep < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.8 KB  |  [TEXT/ttxt]

  1. Subject:     FW_CBitmap at various pixel depths
  2. Sent:        6/9/96 5:09 AM
  3. Received:    6/10/96 8:59 AM
  4. From:        Hutchings Software Development, hsd@earthlink.net
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Hi,
  9.  
  10. I'm trying to use FW_CBitmap as an offscreen buffer for drawing. I'm
  11. allocating a temporary FW_CBitmap object at the beginning of my frame's
  12. Draw method, trying to get the greatest depth possible. Here's how I do it:
  13.  
  14.     FW_CBitmap    offscreen;
  15.     short        pixel_size = 16;
  16.     short        width = FW_FixedToInt(GetBounds(ev).Width());
  17.     short        height = FW_FixedToInt(GetBounds(ev).Height());
  18.     
  19.     FW_Boolean    allocated = false;
  20.     while ((pixel_size > 0) && !allocated)
  21.     {
  22.         try
  23.         {
  24.             offscreen = FW_CBitmap(width, height, pixel_size);
  25.             allocated = true;
  26.         }
  27.         catch (FW_PlatformError error)
  28.         {
  29.             pixel_size = pixel_size / 2;
  30.         }
  31.     }
  32.  
  33.     FW_CBitmapContext    bc(ev, offscreen);
  34.  
  35. Unfortunately, when I start pixel_size at any value greater than the depth
  36. of the screen, I appear to lose a lot of color granularity (e.g.
  37. FW_kRGBLightBlue and FW_kRGBBlue look the same) when I copy the bitmap into
  38. a FW_CViewContext.
  39.  
  40. Here's a runtime scenario that plays out. I've got a PowerBook 5300c with
  41. an external monitor attached.
  42.  
  43.     (1) External set to 256 colors, Built-in at 256 colors. Color problem
  44.         on both displays.
  45.  
  46.     (2) External set to 256 colors, Built-in at Thousands. Only have color
  47.         problem on external.
  48.  
  49.     (3) Internal set to Thousands, mirroring to external. No problems.
  50.  
  51. Any ideas? Other than the color problem, this technique appears to work
  52. great for caching drawing offscreen and bringing it in all at once.
  53.  
  54. Brad
  55.  
  56.  
  57.  
  58. Richard B. "Brad" Hutchings        Coming Very Soon:
  59. General Partner,                    <http://hutchings-software.com>
  60. Hutchings Software Development        
  61. hsd@earthlink.net
  62.